<template>
	<view class="app">
		<wu-list v-if="seen"></wu-list>
		<view  v-else class="hao">
			<view v-for="(item,index) in list" :key="index" class="head">
				<view class="first space-between">
					<view class="title">{{item.package}}</view>
					<view class="price">￥{{Math.round(item.price)}}</view>
				</view>
				<view class="two">{{item.add_time}}</view>
				<view class="xing"></view>
			</view>
		</view>
		
	</view>

</template>

<script>
	import api from '@/api/buy.js'
	import wuList from "./wulist.vue"
	export default {
		components: {
			wuList
		},

		onLoad() {
			this.buyList()
		},
		data() {
			return {
				seen: true,
				list: [],
			}
		},

		methods: {
			async buyList() {
				const openid = uni.getStorageSync('openid')
				const {
					data
				} = await api.buyList({
					openid: openid
				})
				this.list = data
				if (data.length > 0) {
					this.seen = false
				}
				console.log(111)
				console.log(data.length)
				console.log(222)

			},


		}
	}
</script>

<style lang="scss">
	.head {
		margin-top: 60rpx;
		margin-left: 30rpx;
		margin-right: 30rpx;
		margin-bottom: 20rpx;
	}

	.title {
		width: 300rpx;
		height: 29rpx;
		font-size: 28rpx;
		font-family: Microsoft YaHei;
		font-weight: 400;
		color: #333333;
	}

	.price {

		width: 79rpx;
		height: 24rpx;
		font-size: 30rpx;
		font-family: Microsoft YaHei;
		font-weight: bold;
		color: #FB5235;
	}

	.two {
		margin-top: 30rpx;
		width: 207rpx;
		height: 20rpx;
		font-size: 24rpx;
		font-family: Microsoft YaHei;
		font-weight: 400;
		color: #999999;
	}

	.xing {
		margin-top: 50rpx;
		border: 1rpx solid #EEEEEE;
	}
</style>
